.model  tiny
.386
.code
org     100h

code_begin      label   near
        mov     ah, 9
        mov     dx, offset message
        int     21h
        mov     ah, 4ah
        mov     bx, ((offset code_end - offset code_begin) + 20fh) shr 4
        mov     sp, ((offset code_end - offset code_begin) + 1ffh) and -2
        int     21h
        mov     ax, 3533h
        int     21h
        push    es
        push    bx
        pop     dword ptr ds:[offset jfar_33h + 1]
        mov     ah, 25h
        mov     dx, offset new_33h
        int     21h
        push    ds
        pop     es
        mov     bx, offset exec_block
        mov     word ptr ds:[bx + 4], cs
        mov     word ptr ds:[bx + 8], cs
        mov     word ptr ds:[bx + 0ch], cs
        mov     ax, 4b00h
        mov     dx, offset scenario_exe
        int     21h
        lds     dx, dword ptr cs:[offset jfar_33h + 1]
        mov     ax, 2533h
        int     21h
        mov     ah, 4ch
        int     21h

new_33h         proc    near
        test    ax, ax
        jne     jfar_33h
        pushf
        call    dword ptr cs:[offset jfar_33h + 1]
        mov     bl, 2
        retf    2

jfar_33h        label   near
        db      0eah, 'P', 'F', 'P', 'F'
new_33h         endp

scenario_exe    db      "scenario.exe", 0
exec_block      dw      0, 80h, 0, 5ch, 0, 6ch, 0

message         db "DOSBox fix for Scenario", 0dh, 0ah
                db "by Peter Ferrie (peter_ferrie@hotmail.com)", 0dh, 0ah, "$"

code_end        label   near
end             code_begin
